package org.jeecg.modules.online.cgform.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import java.lang.invoke.SerializedLambda;
import java.util.Iterator;
import java.util.List;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.online.cgform.entity.OnlCgformField;
import org.jeecg.modules.online.cgform.entity.OnlCgformHead;
import org.jeecg.modules.online.cgform.mapper.OnlCgformFieldMapper;
import org.jeecg.modules.online.cgform.mapper.OnlCgformHeadMapper;
import org.jeecg.modules.online.cgform.service.IOnlineBaseAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("onlineBaseAPI")
/* renamed from: org.jeecg.modules.online.cgform.service.a.g */
/* loaded from: hibernate-re-3.7.1-RC.jar:org/jeecg/modules/online/cgform/service/a/g.class */
public class OnlineBaseAPIServiceImpl implements IOnlineBaseAPI {
    @Autowired
    private OnlCgformHeadMapper onlCgformHeadMapper;
    @Autowired
    private OnlCgformFieldMapper onlCgformFieldMapper;

    /* renamed from: a */
//    private static /* synthetic */ Object m184a(SerializedLambda serializedLambda) {
//        String implMethodName = serializedLambda.getImplMethodName();
//        boolean z = true;
//        switch (implMethodName.hashCode()) {
//            case -1998322493:
//                if (implMethodName.equals("getTableName")) {
//                    z = true;
//                    break;
//                }
//                break;
//            case 713008857:
//                if (implMethodName.equals("getCgformHeadId")) {
//                    z = false;
//                    break;
//                }
//                break;
//        }
//        switch (z) {
//            case false:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformField") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getCgformHeadId();
//                    };
//                }
//                break;
//            case true:
//                if (serializedLambda.getImplMethodKind() == 5 && serializedLambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && serializedLambda.getFunctionalInterfaceMethodName().equals("apply") && serializedLambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && serializedLambda.getImplClass().equals("org/jeecg/modules/online/cgform/entity/OnlCgformHead") && serializedLambda.getImplMethodSignature().equals("()Ljava/lang/String;")) {
//                    return (v0) -> {
//                        return v0.getTableName();
//                    };
//                }
//                break;
//        }
//        throw new IllegalArgumentException("Invalid lambda deserialization");
//    }

    @Override // org.jeecg.modules.online.cgform.service.IOnlineBaseAPI
    public String getOnlineErpCode(String code, String tableType) {
        OnlCgformHead onlCgformHead = null;
        if ("3".equals(tableType)) {
            String substring = code.substring(1);
            OnlCgformHead onlCgformHead2 = (OnlCgformHead) this.onlCgformHeadMapper.selectById(substring);
            if (onlCgformHead2 != null && onlCgformHead2.getTableType().intValue() == 3) {
                List selectList = this.onlCgformFieldMapper.selectList(new LambdaQueryWrapper<OnlCgformField>().eq(OnlCgformField::getCgformHeadId, substring));
                if (selectList != null && selectList.size() > 0) {
                    String str = null;
                    Iterator it = selectList.iterator();
                    while (true) {
                        if (!it.hasNext()) {
                            break;
                        }
                        OnlCgformField onlCgformField = (OnlCgformField) it.next();
                        if (oConvertUtils.isNotEmpty(onlCgformField.getMainTable())) {
                            str = onlCgformField.getMainTable();
                            break;
                        }
                    }
                    if (( this.onlCgformHeadMapper.selectOne( new LambdaQueryWrapper<OnlCgformHead>().eq(OnlCgformHead::getTableName, str))) != null) {
                        code = "/" + onlCgformHead.getId();
                    }
                }
            }
        }
        return code;
    }
}
